<template>
  <div class="preview-body" @click="handleClick()">
    <div class="preview-img">
      <img :src="picture" alt="">
    </div>
  </div>
</template>

<script>
export default {
  name: "PicturePreview",
  props: {
    picture: {
      type: String,
      required: true,
    },
    visible:{
      type: Boolean,
      required: true,
    }
  },
  setup(props, context) {
    const handleClick = () =>{
      context.emit("update:visible", false)
    }

    return {
      handleClick
    }
  }
}
</script>

<style scoped>
.preview-body {
  width: 100%;
  height: 100%;
  position: fixed;
  left:0;
  top:0;
  z-index: 1005;
  background-color: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-body .preview-img img{
  width: 100%;
}
</style>